﻿<controls:BorderLessWindow
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:me="clr-namespace:SoGame.ViewModels" 
        xmlns:Controls="clr-namespace:SoGame.Controls"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:controls="clr-namespace:SoGame.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:System_Windows_Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" mc:Ignorable="d" x:Class="SoGame.Views.MainWindow"
        Title="SoGame">

    <controls:BorderLessWindow.Resources>
        <me:MainWindowViewModel x:Key="viewModel" />
        <Style x:Key="TextBoxStyle1" TargetType="{x:Type TextBox}">
        	<Setter Property="OverridesDefaultStyle" Value="True"/>
        	<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        	<Setter Property="MinHeight" Value="26"/>
        	<Setter Property="CaretBrush" Value="{DynamicResource MetroTextBoxCaret}" />
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="{x:Type TextBox}">
        				<Border x:Name="Border" Background="{DynamicResource MetroTextBoxBg}" BorderBrush="{DynamicResource MetroTextBoxBg}" BorderThickness="1">
        					<Grid Height="19" Margin="2,0">
        						<Button HorizontalAlignment="Right" Style="{DynamicResource MetroPathButton}" Command="{Binding SearchCommand}">
        						<Grid HorizontalAlignment="Right" Height="Auto" Width="21" Margin="0,-2,0,2">
        							<Ellipse HorizontalAlignment="Center" Width="10" Height="10" Stroke="{DynamicResource GrayBrush6}" StrokeThickness="1.5"/>
        							<Path Data="M2,11 L-2.5,19" HorizontalAlignment="Left" Height="10.056" Margin="3.177,0,0,-1.03" Stretch="Fill" Stroke="{DynamicResource GrayBrush6}" UseLayoutRounding="False" VerticalAlignment="Bottom" Width="5.5" StrokeThickness="3" RenderTransformOrigin="0.5,0.5">
        								<Path.RenderTransform>
        									<TransformGroup>
        										<ScaleTransform/>
        										<SkewTransform/>
        										<RotateTransform Angle="19.558"/>
        										<TranslateTransform/>
        									</TransformGroup>
        								</Path.RenderTransform>
        							</Path>
        						</Grid>
								</Button>
        						<ScrollViewer Margin="0,0,23,0" FontSize="13" x:Name="PART_ContentHost" d:LayoutOverrides="Height" />
        					</Grid>
        				</Border>
        				<ControlTemplate.Triggers>
        					<Trigger Property="IsEnabled" Value="False">
        						<Setter TargetName="Border" Property="Opacity" Value="0.5"/>
        					</Trigger>
        					<Trigger Property="IsMouseOver" Value="True">
        						<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
        					</Trigger>
        					<Trigger Property="IsFocused" Value="True">
        						<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxBorderHover}"/>
        						<Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
        					</Trigger>
        					<Trigger Property="Validation.HasError" Value="True">
        						<Setter Property="ToolTip" Value="{Binding (Validation.Errors)[0].ErrorContent, RelativeSource={RelativeSource Self}}" />
        						<Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxErrorBg}" />
        						<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBg}" />
        					</Trigger>
        					<MultiTrigger>
        						<MultiTrigger.Conditions>
        							<Condition Property="Validation.HasError" Value="True" />
        							<Condition Property="IsMouseOver" Value="True" />
        						</MultiTrigger.Conditions>
        						<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
        					</MultiTrigger>
        					<MultiTrigger>
        						<MultiTrigger.Conditions>
        							<Condition Property="Validation.HasError" Value="True" />
        							<Condition Property="IsFocused" Value="True" />
        						</MultiTrigger.Conditions>
        						<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource MetroTextBoxErrorBorder}"/>
        						<Setter TargetName="Border" Property="Background" Value="{DynamicResource MetroTextBoxBgFocus}"/>
        					</MultiTrigger>
        				</ControlTemplate.Triggers>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        	<Setter Property="Validation.ErrorTemplate">
        		<Setter.Value>
        			<ControlTemplate>
        				<AdornedElementPlaceholder />
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        	<Setter Property="ContextMenu">
        		<Setter.Value>
        			<ContextMenu>
        				<MenuItem Header="Cut" Command="ApplicationCommands.Cut"/>
        				<MenuItem Header="Copy" Command="ApplicationCommands.Copy"/>
        				<MenuItem Header="Paste" Command="ApplicationCommands.Paste"/>
        			</ContextMenu>
        		</Setter.Value>
        	</Setter>
        </Style>
    </controls:BorderLessWindow.Resources>

	<controls:BorderLessWindow.Style>
		<StaticResource ResourceKey="MetroWindow"/>
	</controls:BorderLessWindow.Style>

    <controls:BorderLessWindow.TaskbarItemInfo>
        <TaskbarItemInfo/>
    </controls:BorderLessWindow.TaskbarItemInfo>

    <!--<Grid>
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="32,41,0,0" Name="button1" VerticalAlignment="Top" Width="75" Command="{Binding Source={StaticResource viewModel}, Path=ClickCommand}" />
        <TextBox Height="23" HorizontalAlignment="Left" Margin="32,12,0,0" Name="textBox1" VerticalAlignment="Top" Width="226" Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Source={StaticResource viewModel}, Path=TextBox, ValidatesOnExceptions=True, StringFormat=\{0:F\}, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" />
    </Grid>-->
    <Grid x:Name="LayoutRoot" Margin="0,40,0,0" DataContext="{Binding Source={StaticResource viewModel}}">
    	<Grid.RowDefinitions>
    		<RowDefinition Height="*"/>
    		<RowDefinition Height="Auto"/>
    	</Grid.RowDefinitions>
        <Grid Background="Transparent" Margin="0,-12,0,0">
            <Grid.RowDefinitions>
            	<RowDefinition Height="Auto"/>
            	<RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock TextWrapping="Wrap" VerticalAlignment="Top" Foreground="Black" FontFamily="Segoe WP" FontSize="26.667" RenderTransformOrigin="0,-1.522" Margin="30,10,0,0" HorizontalAlignment="Left" Text="SoGame"/>
            <StackPanel Grid.ColumnSpan="3" Margin="30,0,0,10" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Bottom">
                <ItemsControl x:Name="NavLinks" ItemsSource="{Binding AllNavLinks, Mode=OneWay}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Button Command="{Binding DataContext.NavigateCommand, ElementName=LayoutRoot}" CommandParameter="{Binding}" Style="{DynamicResource MetroPathTitleButton}">
                            	<TextBlock Text="{Binding NavText}" Style="{DynamicResource MetroHeader1}" Margin="0,0,25,0" />                     
							</Button>
                            <!--<controls:NavigationControl 
                                    NavText="{Binding Path=NavText,Mode=OneWay}" 
                                    NavUri="{Binding Path=URIPath, Mode=OneWay}" 
                                    CurrentState="{Binding Path=LinkVisualState, Mode=OneWay}" 
                                    SeparatorStyle="{StaticResource DividerStyle}" 
                                    HyperLinkStyle="{StaticResource LinkStyle}" 
                                    SeparatorVisible="{Binding Path=ShowNavRectable, Mode=OneWay}" 
                                    TargetName="ContentFrame" />-->
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
            <Rectangle Fill="{DynamicResource HighlightBrush}" HorizontalAlignment="Left" Margin="-24,8,0,12.607" Width="37" Height="65"/>
            <TextBox TextWrapping="Wrap" Text="{Binding SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Margin="0,20,20,0" HorizontalAlignment="Right" Width="200" Style="{DynamicResource TextBoxStyle1}" />
            <Frame Content="Frame" NavigationUIVisibility="Hidden" Grid.Row="1" Margin="10,10,20,10" Source="{Binding CurrentUri.URI}"/>
            <Grid HorizontalAlignment="Right" Height="40" Margin="0,-28,148,0" VerticalAlignment="Top" Width="40">
            	<Rectangle Fill="{DynamicResource HighlightBrush}" d:LayoutOverrides="VerticalAlignment"/>
            	<Image Source="/SoGame;component/Assets/Images/logo_blanc.png"/>
            </Grid>
			<Button VerticalAlignment="Center" HorizontalAlignment="Left" Margin="25,-82,0,0" 
                    Command="{Binding BackCommand}"
                    Style="{DynamicResource MetroPathButton}">
            <Grid Width="30" >
            	<Path Data="M8,15.5 L22.008926,15.5" Height="10" Stretch="Fill" Stroke="Black" VerticalAlignment="Center" StrokeThickness="1.5" Width="12" HorizontalAlignment="Center"/>
            	<Ellipse Stroke="{DynamicResource DisabledControlBrush}" StrokeThickness="1.5" Width="20" Height="20" Margin="4,0,6,0"/>
            	<Path Data="M13.75,5 L9,9.75" HorizontalAlignment="Left" Margin="7.75,4.25,0,9" Stretch="Fill" Stroke="Black" StrokeThickness="1.5" UseLayoutRounding="False" Width="6.75"/>
            	<Path Data="M9,10.75 L14.75,15" Margin="7.5,8.75,14.75,5" Stretch="Fill" Stroke="Black" StrokeThickness="1.5" UseLayoutRounding="False"/>
            </Grid>
			</Button>
			<Button VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,-103,112,0" 
				Command="{Binding RefreshCommand}"
				Style="{DynamicResource MetroPathButton}">
				<Grid Width="30" >
            <Image Width="28" Height="28" Source="/SoGame;component/Assets/Images/appbar.sync.rest.png" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,2,0"/>
            <Ellipse Stroke="{DynamicResource DisabledControlBrush}" StrokeThickness="1.5" Width="20" Height="20" Margin="4,0,6,0"/>
			</Grid>
			</Button>
        </Grid>
        <StackPanel HorizontalAlignment="Left" Grid.Row="1" Margin="25,5,5,20" Orientation="Horizontal">
        	<Button Style="{DynamicResource MetroPathButton}" Margin="15,5" VerticalAlignment="Top"><Path Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF878787" Data="M 33.2772,21.3316L 42.2365,21.3316C 42.5899,21.3316 42.8764,21.6181 42.8764,21.9715L 42.8764,42.6098C 42.8764,42.9632 42.5899,43.2497 42.2365,43.2497L 33.2772,43.2497C 32.9238,43.2497 32.6373,42.9632 32.6373,42.6098L 32.6373,21.9715C 32.6373,21.6181 32.9238,21.3316 33.2772,21.3316 Z M 32.6906,39.9434L 35.4109,39.9434L 35.4109,40.7197L 39.9434,40.7197L 39.9434,39.9947L 42.8764,39.9947" Height="34.999" UseLayoutRounding="False" Width="16.879"/></Button>
            <Button Command="{Binding DataContext.StartKinect, ElementName=LayoutRoot}" Style="{DynamicResource MetroPathButton}" Margin="15,5" VerticalAlignment="Top">
                <StackPanel Orientation="Vertical" Width="92">
                    <Path Visibility="{Binding IsKinectConnected, Converter={StaticResource VisibilityConverter}, ConverterParameter='false'}" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF878787" Data="M 15.4387,26.1578L 59.4351,26.1578C 60.1419,26.1578 60.7149,26.7309 60.7149,27.4377L 60.7149,31.2774C 60.7149,31.9843 60.1419,32.5573 59.4351,32.5573L 15.4387,32.5573C 14.7318,32.5573 14.1588,31.9843 14.1588,31.2774L 14.1588,27.4377C 14.1588,26.7309 14.7318,26.1578 15.4387,26.1578 Z M 36.397,32.6373L 30.7175,35.3571L 30.7175,37.4384L 44.5584,37.4384L 44.5584,35.2757L 38.1568,32.5573M 23.818,27.4377C 24.8783,27.4377 25.7379,28.2973 25.7379,29.3576C 25.7379,30.4179 24.8783,31.2774 23.818,31.2774C 22.7577,31.2774 21.8982,30.4179 21.8982,29.3576C 21.8982,28.2973 22.7578,27.4377 23.818,27.4377 Z M 40.4569,27.5177C 41.5172,27.5177 42.3767,28.3773 42.3767,29.4376C 42.3767,30.4979 41.5172,31.3574 40.4569,31.3574C 39.3966,31.3574 38.537,30.4979 38.537,29.4376C 38.537,28.3773 39.3966,27.5177 40.4569,27.5177 Z M 34.7569,27.5177C 35.8172,27.5177 36.6767,28.3773 36.6767,29.4376C 36.6767,30.4979 35.8172,31.3574 34.7569,31.3574C 33.6966,31.3574 32.837,30.4979 32.837,29.4376C 32.837,28.3773 33.6966,27.5177 34.7569,27.5177 Z M 29.4376,28.8776C 29.9677,28.8776 30.3975,29.3074 30.3975,29.8375C 30.3975,30.3677 29.9677,30.7975 29.4376,30.7975C 28.9074,30.7975 28.4776,30.3677 28.4776,29.8375C 28.4776,29.3074 28.9074,28.8776 29.4376,28.8776 Z " Height="23.17" UseLayoutRounding="False" Margin="0,0,0.26,0"/>
                    <Path Visibility="{Binding IsKinectConnected, Converter={StaticResource VisibilityConverter}}" Stretch="Fill" StrokeLineJoin="Round" Data="M 15.4387,26.1578L 59.4351,26.1578C 60.1419,26.1578 60.7149,26.7309 60.7149,27.4377L 60.7149,31.2774C 60.7149,31.9843 60.1419,32.5573 59.4351,32.5573L 15.4387,32.5573C 14.7318,32.5573 14.1588,31.9843 14.1588,31.2774L 14.1588,27.4377C 14.1588,26.7309 14.7318,26.1578 15.4387,26.1578 Z M 36.397,32.6373L 30.7175,35.3571L 30.7175,37.4384L 44.5584,37.4384L 44.5584,35.2757L 38.1568,32.5573M 23.818,27.4377C 24.8783,27.4377 25.7379,28.2973 25.7379,29.3576C 25.7379,30.4179 24.8783,31.2774 23.818,31.2774C 22.7577,31.2774 21.8982,30.4179 21.8982,29.3576C 21.8982,28.2973 22.7578,27.4377 23.818,27.4377 Z M 40.4569,27.5177C 41.5172,27.5177 42.3767,28.3773 42.3767,29.4376C 42.3767,30.4979 41.5172,31.3574 40.4569,31.3574C 39.3966,31.3574 38.537,30.4979 38.537,29.4376C 38.537,28.3773 39.3966,27.5177 40.4569,27.5177 Z M 34.7569,27.5177C 35.8172,27.5177 36.6767,28.3773 36.6767,29.4376C 36.6767,30.4979 35.8172,31.3574 34.7569,31.3574C 33.6966,31.3574 32.837,30.4979 32.837,29.4376C 32.837,28.3773 33.6966,27.5177 34.7569,27.5177 Z M 29.4376,28.8776C 29.9677,28.8776 30.3975,29.3074 30.3975,29.8375C 30.3975,30.3677 29.9677,30.7975 29.4376,30.7975C 28.9074,30.7975 28.4776,30.3677 28.4776,29.8375C 28.4776,29.3074 28.9074,28.8776 29.4376,28.8776 Z " Height="23.17" UseLayoutRounding="False" Margin="0,0,0.26,0" Fill="Black"/>
                    <TextBlock TextWrapping="Wrap" Text="{Binding KinectStatut}" Visibility="{Binding IsKinectConnected, Converter={StaticResource VisibilityConverter}}" HorizontalAlignment="Center"/>
                    <TextBlock TextWrapping="Wrap" Text="{Binding KinectStatut}" Visibility="{Binding IsKinectConnected, Converter={StaticResource VisibilityConverter}, ConverterParameter='false'}" HorizontalAlignment="Center"/>
                </StackPanel>
            </Button>
            <Button Command="{Binding DataContext.FacebookConnectionCommand, ElementName=LayoutRoot}" Style="{DynamicResource MetroPathButton}" Margin="15,5" VerticalAlignment="Top">
                <StackPanel Orientation="Horizontal">
                    <Grid Height="30" Width="30" Visibility="{Binding FacebookStatus, Converter={StaticResource FacebookVisibilityConverter}, ConverterParameter='false' }">
                        <Rectangle Stroke="#FF878787" StrokeLineJoin="Round" RadiusX="4" RadiusY="4" />
                        <TextBlock TextWrapping="Wrap" Text="f" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="24" FontFamily="Segoe WP" Margin="0,0,4,0" FontWeight="Bold"/>
                    </Grid>
                    <Grid Height="30" Width="30" Visibility="{Binding FacebookStatus, Converter={StaticResource FacebookVisibilityConverter} }">
                        <Rectangle Stroke="Navy" StrokeLineJoin="Round" RadiusX="4" RadiusY="4" Fill="Navy" />
                        <TextBlock TextWrapping="Wrap" Text="f" VerticalAlignment="Center" Foreground="White" HorizontalAlignment="Right" FontSize="24" FontFamily="Segoe WP" Margin="0,0,4,0" FontWeight="Bold"/>
                    </Grid>
                </StackPanel>
            </Button>

            <Grid Height="32" Width="32" Margin="15,5" VerticalAlignment="Top" Visibility="{Binding IsSendingMail, Converter={StaticResource VisibilityConverter}}">
                <Rectangle Stroke="#FF878787" StrokeLineJoin="Round" RadiusX="4" RadiusY="4" />
                <StackPanel Orientation="Vertical">
                    <TextBlock TextWrapping="Wrap" Text="@" VerticalAlignment="Top" HorizontalAlignment="Center" FontSize="18" FontFamily="Segoe WP" FontWeight="Bold" />
                    <ProgressBar 
                         Minimum="0" Maximum="{Binding MailsToSend}" Value="{Binding CurrentMail}"
                         Width="30" Height="6"
                         />
                </StackPanel>
            </Grid>

        </StackPanel>
        <TextBlock HorizontalAlignment="Right" Margin="0,-20,193,0" TextWrapping="Wrap" VerticalAlignment="Top" Style="{DynamicResource MetroSmallText}" FontWeight="Bold" Foreground="{DynamicResource HighlightBrush}" Text="so@t"/>
        <TextBlock HorizontalAlignment="Right" Margin="0,-38,193,0" TextWrapping="Wrap" VerticalAlignment="Top" Style="{DynamicResource WaterMarkerTextBlock}" FontWeight="Bold"><Run Language="fr-fr" Text="SOGAME"/></TextBlock>
    </Grid>
</controls:BorderLessWindow>
